package 刷题10月.leecodehot100;

import java.util.List;

public class demo2 {
    public static void main(String[] args) {
        int arr[]={1,5,8,9,12,88};
        System.out.println(find(arr,12));
        System.out.println(find(arr,152));
    }
    public static int find(int arr[],int target){
        int left=0,right=arr.length-1;
        int mid;
        while (left<=right){
            mid=left+(right-left)/2;
            if(target==arr[mid]){
                return mid;
            }else if(arr[mid]<target){
                right=mid-1;
            }else {
                left=mid+1;
            }
        }
        return -1;
    }
}
//select student_id
//from score
//group by student_id
//having sum(score)>300
